namespace DA.AnimGraph {
    internal struct IntLink {

        private readonly AUID name;
        private readonly LinkSourceType sourceType;
        public int value { get; private set; }

        public IntLink(in IntLinkDesc desc) {
            name = desc.name;
            sourceType = desc.sourceType;
            value = desc.defaultValue;
        }

        internal int Evaluate(in EvaluateContext evaluateContext, in GraphContext graphContext, in ScopeContext scope) {
            if (scope.disableBlackboardUpdate) return value;
            if (sourceType == LinkSourceType.Const) return value;

            int newValue = value;

            switch (sourceType) {
                case LinkSourceType.Blackboard:
                    graphContext.blackboard.GetValue(name, ref newValue);
                    break;
            }

            value = newValue;
            return value;
        }
    }
}
